package com.junzhiit.nengji.shop.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class AccessControlAllowOriginInterceptor extends HandlerInterceptorAdapter {

	protected Log logger = LogFactory.getLog(this.getClass().getName());

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setHeader("Access-Control-Allow-Headers", "content-type");
		logger.debug("AccessControlAllowOriginInterceptor run.....");
		return true;
	}

}
